package cn.skylark.wcm.controller;

import cn.skylark.wcm.common.util.Constants;
import cn.skylark.wcm.common.util.ReturnMap;
import cn.skylark.wcm.common.util.UploadHelper;
import cn.skylark.wcm.entity.Filetable;
import cn.skylark.wcm.entity.Tenan;
import cn.skylark.wcm.entity.User;
import cn.skylark.wcm.service.FileManagerService;
import cn.skylark.wcm.service.FileUploadService;
import cn.skylark.wcm.service.TenanService;
import com.github.pagehelper.PageInfo;
import net.sf.json.JSONArray;
import org.apache.commons.collections.map.HashedMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.*;

/**
 *  *Description:网页管理
 *  *
 *  *Copyright:wcm
 *  *@author 武文旭
 *  *@version 1.0 
 *
 * @date 2018/01/08
 *  
 */
@RestController
@RequestMapping("/pagemanager")
public class PageMangerController {
    /**
     * logger
     */
    private static final Logger LOGGER = LoggerFactory.getLogger(PageMangerController.class);
    @Autowired
    FileUploadService fileUploadService;
    @Autowired
    TenanService tenanService;
    @Autowired
    FileManagerService fileMangerService;

    /**
     * 获取网页管理所有文件
     * 业务:通过传入的userid来确认用户
     * 将用户下的所有系统(Type为1网页)的文件返回
     *
     * @param filetable Filetable
     * @param request   HttpServletRequest
     * @param start     int
     * @param length    int
     * @return List<Filetable>
     * @throwsException sql异常 数据库连接失败
     */
    @RequestMapping("/getHtmlFile")
    public Map<String, Object> getHtmlFile(Filetable filetable, HttpServletRequest request,
                                           @RequestParam(required = false, defaultValue = "1") int start,
                                           @RequestParam(required = false, defaultValue = "10") int length) {
        String searchValue = request.getParameter("search[value]");
        String flag = request.getParameter("flag");
        LOGGER.info("获取网页管理所有文件开始 Filetable:" + filetable + "状态" + flag + "搜索内容:" + searchValue + "起始页:" + start + "显示条数:" + length);
        Map<String, Object> map = fileUploadService.selectByPage(filetable, flag, searchValue, start, length);
        LOGGER.info("获取网页管理所有文件结束");
        return map;
    }

    /**
     * 获取文件夹内的数据
     * 业务:通过传入的filetable的id，查看文件夹下
     * 的文件，并返回
     *
     * @param id     Integer
     * @param draw   String
     * @param start  Integer
     * @param length Integer
     * @return List<Filetable>
     * @throwsException sql异常 数据库连接失败
     */
    @RequestMapping("/getHtmlFolder")
    public Map<String, Object> getHtmlFolder(Integer id, String draw, HttpServletRequest request,
                                             @RequestParam(required = false, defaultValue = "1") int start,
                                             @RequestParam(required = false, defaultValue = "10") int length) {
        LOGGER.info("获取文件夹下所有文件开始 文件id:" + id + "起始页:" + start + "显示条数:" + length);
        String searchValue = request.getParameter("search[value]");
        //通过文件的id获取文件列表
        Filetable filetableId = new Filetable();
        filetableId.setId(id);
        Filetable filetable = fileUploadService.getFiletable(filetableId);
        Map map = fileUploadService.selectByPageFolder(filetable, searchValue, start, length);
        return map;
    }

    /**
     * html文件上传
     * 业务:html文件上传，获取上传文件输出的本地文件夹内，
     * 转存入腾讯对象存储服务器上，获取上传状态，如上传对象存储
     * 成功则将相关数据存入数据库，在controller层做了文件类型、
     * 文件大小、文件重复的判断
     *
     * @param request
     * @param httpServletRequest
     * @return
     * @throwsException sql异常 数据库连接失败
     */
    @RequestMapping(value = "/uploadHTMLFile", method = RequestMethod.POST)
    public Map<String, Object> uploadHTMLFile(MultipartHttpServletRequest request,
                                              HttpServletRequest httpServletRequest, @RequestParam(required = false, defaultValue = "1") int start,
                                              @RequestParam(required = false, defaultValue = "10") int length) {
        Map<String, Object> map = new HashMap();
        try {
            LOGGER.info("文件上传开始");
            MultiValueMap<String, MultipartFile> linkedHashMap = request.getMultiFileMap();
            //上传本地路径
            String localfilepath = request.getParameter("filepath");
            System.out.println("上传地址" + localfilepath);
            String tenanid = request.getParameter("tenanid");
            String userid = request.getParameter("userid");
            String fatherid = request.getParameter("fatherid");
            LOGGER.info("fatherid=====" + fatherid);
            String father;
            User user = new User();
            if (fatherid == null || "".equals(fatherid)) {
                father = "";
                //判断是否同一用户进行操作
                user.setId(Integer.valueOf(userid));
                user.setTenanid(Integer.valueOf(tenanid));
            } else {
                Filetable filetable = fileMangerService.selectById(Integer.valueOf(fatherid));
                father = filetable.getLocalpath() + filetable.getFilename() + "/";
                //判断是否同一用户进行操作
                Filetable filetableMessage=new Filetable();
                filetableMessage.setId(Integer.valueOf(fatherid));
                Filetable message=fileUploadService.getFiletable(filetableMessage);
                if((Integer.valueOf(userid)==message.getUserid())&&(Integer.valueOf(tenanid)==message.getTenanid())){
                    //传入用户信息，与父文件夹信息不同
                    user.setId(Integer.valueOf(userid));
                    user.setTenanid(Integer.valueOf(tenanid));
                }else {
                    //传入用户信息，与父文件夹信息不同
                    user.setId(message.getUserid());
                    user.setTenanid(message.getTenanid());
                }
            }

            //服务器临时目录
            String realPath = Constants.REALPATH;
            //上传文件取得
            List<MultipartFile> multipartFiles = UploadHelper.getFileSet(request, new String[]{".html", ".htm"});
            if (linkedHashMap.get("uploadfile[]").size() != multipartFiles.size()) {
                map.put("code", 1);
                map.put("message", "文件类型不符");
                return map;
            }
            //遍历判断所传文件的大小
            long size = 0;
            Set<String> set = new HashSet<>();
            String[] localpathlist = localfilepath.split("\\|");
            for ( int i=0;i<multipartFiles.size();i++){
                MultipartFile multipartFile = multipartFiles.get(i);
                size += multipartFile.getSize();
                String filename;
                if (!"undefined".equals(localpathlist[i])) {
                    //如果不为undefined 就是相对路径
                    filename = father + "" + localpathlist[i];
                    set.add(filename);
                } else {
                    //如果是undefined 就是文件名 xx.xx
                    filename = father + "" + multipartFile.getOriginalFilename();
                    set.add(filename);
                }
                //判断文件是否存在
                if (!fileUploadService.selectFileRepeat(filename, Integer.valueOf(tenanid),
                        Integer.valueOf(userid), 1)) {
                    map.put("code", 1);
                    map.put("message", "文件已存在");
                    return map;
                }
            }
            //判断传过来是否有同名的文件或文件夹
            if (set.size()!=localpathlist.length){
                map.put("code", 1);
                map.put("message", "上传文件中有同名文件或文件夹存在");
                return map;
            }
            //得到所有的文件大小的总和之后要和该租户下的数据库储存空间大小进行比对
            Tenan tenan = tenanService.getStorageById(Integer.valueOf(tenanid));
            Long storage = tenan.getStorage();
            //得到已经已经用的储存空间大小
            String totalSize = fileUploadService.getTotalSize(Integer.valueOf(tenanid));
            if (totalSize == null || "".equals(totalSize)) {
                totalSize = "0";
            }
            long remainStorage = storage - Long.valueOf(totalSize);
            if (size > remainStorage) {
                map.put("code", 1);
                map.put("message", "存储空间不足");
                return map;
            }
            String param = "html";

            //上传腾讯对象存储
            map = fileUploadService.uploadFileLocal(multipartFiles, localfilepath, realPath, user, father, param, 1);
            LOGGER.info("html文件上传结束");
            return map;
        } catch (Exception e) {
            LOGGER.info("文件上传数据库异常" + e);
            map.put("code", 1);
            map.put("message", "文件上传数据库异常");
            e.printStackTrace();
            return map;
        }
    }

    /**
     * 上传在线生成的html
     * 业务：通过网页在线生成的网页，点击上传，获取上传文件输出的本地文件夹内，
     * 转存入腾讯对象存储服务器上，获取上传状态，如上传对象存储
     * 成功则将相关数据存入数据库，在controller层做了文件类型、
     * 文件大小、文件重复的判断
     *
     * @param request
     * @param htmlfile
     * @param tenanid
     * @param userid
     * @param htmlname
     * @param fatherid
     * @return
     * @throwsException sql异常 数据库连接失败
     */
    @RequestMapping(value = "/uploadHTML", method = RequestMethod.POST)
    public Map<String, Object> uploadHTML(HttpServletRequest request, String htmlfile, Integer tenanid, Integer userid, String htmlname, Integer fatherid, Integer id,
                                          @RequestParam(required = false, defaultValue = "1") int start,
                                          @RequestParam(required = false, defaultValue = "10") int length) {
        ReturnMap ret = new ReturnMap();
        LOGGER.info("上传在线生成的html开始 请求：" + request + "网页信息:" + htmlfile + "租户id" + tenanid
                + "用户id:" + userid + "网页名称:" + htmlname + "父id" + fatherid + "文件id" + id);
        Map<String, Object> map = new HashMap<>();
        //上传本地路径
        try {
            Filetable htmlMessage;
            if (id != null) {
                Filetable filetable = new Filetable();
                filetable.setId(id);
                htmlMessage = fileUploadService.getFiletable(filetable);
                fileUploadService.deleteHtml(htmlMessage);
                fileUploadService.deleteTxt(htmlMessage);
                User user = new User();
                user.setTenanid(htmlMessage.getTenanid());
                user.setId(htmlMessage.getUserid());
                //服务器临时目录
                String realPath = Constants.REALPATH;
                String htmlnameMessage = htmlMessage.getFilename() + ".html";
                String fatherPath = null;
                if (htmlMessage.getLocalpath() == null || "".equals(htmlMessage.getLocalpath())) {
                    fatherPath = "";
                } else {
                    fatherPath = htmlMessage.getLocalpath().substring(0, htmlMessage.getLocalpath().lastIndexOf("/") + 1);
                }
                map = fileUploadService.uploadFileHtmlLocal(htmlfile, htmlnameMessage, user, fatherPath, realPath);
                //返回结果
                LOGGER.info("保存在线生成的html结束");
                return map;
            } else {
                String fatherPath;
                if (fatherid == null || "".equals(fatherid)) {
                    fatherPath = "";
                } else {
                    Filetable filetableFatherId = new Filetable();
                    filetableFatherId.setId(fatherid);
                    Filetable filetable = fileUploadService.getFiletable(filetableFatherId);
                    fatherPath = filetable.getLocalpath() + filetable.getFilename() + "/";
                }
                User user = new User();
                user.setId(Integer.valueOf(userid));
                user.setTenanid(Integer.valueOf(tenanid));
                //服务器临时目录
                String realPath = Constants.REALPATH;
                //判断所传文件的大小
                long size = htmlfile.getBytes("UTF-8").length;
                //得到已经已经用的储存空间大小
                String totalSize = fileUploadService.getTotalSize(Integer.valueOf(tenanid));
                if (totalSize == null || "".equals(totalSize)) {
                    totalSize = "0";
                }
                //得到所有的文件大小的总和之后要和该租户下的数据库储存空间大小进行比对
                Tenan tenan = tenanService.getStorageById(Integer.valueOf(tenanid));
                Long storage = tenan.getStorage();
                long remainStorage = storage - Long.valueOf(totalSize);
                if (size > remainStorage) {
                    map.put("flg", 1);
                    map.put("message", "储存空间不足");
                    return map;
                }
                if (fatherPath == null) {
                    fatherPath = "";
                }
                String htmlnamepath = fatherPath + "" + htmlname + ".html";
                String htmlnameMessage = htmlname + ".html";
                //判断文件是否存在
                if (!fileUploadService.selectFileRepeat(htmlnamepath, Integer.valueOf(tenanid),
                        Integer.valueOf(userid), 1)) {
                    map.put("flg", 1);
                    map.put("message", "文件已存在");
                    return map;
                }
                //上传腾讯对象存储
                map = fileUploadService.uploadFileHtmlLocal(htmlfile, htmlnameMessage, user, fatherPath, realPath);
                //返回结果
                LOGGER.info("上传在线生成的html结束");
                return map;
            }
        } catch (Exception e) {
            LOGGER.info("文件上传数据库异常" + e);
            map.put("flg", 1);
            map.put("message", "文件上传数据库异常");
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 新建文件夹
     * 业务： 前端传过来路径，分别以locapath和filename来传
     * 先判断文件夹是否存在，然后进行添加的操作。如果在根目录下新建，则localpath为空
     * 只传filename，如果在文件夹下建文件夹，则他的前面路径作为localpath来传，形式为：src/a/b/
     *
     * @param filetable
     * @return
     * @throwsException sql异常 数据库连接失败
     */
    @RequestMapping(value = "/saveFolder")
    public Map<String, Object> saveFolder(Filetable filetable, HttpServletRequest request,
                                          @RequestParam(required = false, defaultValue = "1") int start,
                                          @RequestParam(required = false, defaultValue = "10") int length) {
        LOGGER.info("新建文件夹开始 文件:" + filetable);
        Map<String, Object> map = new HashMap<>();
        try {
            String fatherid = request.getParameter("fatherid");
            LOGGER.info("fatherid=====" + fatherid);
            String father;
            if (fatherid == null || "".equals(fatherid)) {
                father = "";
            } else {
                Filetable filetableMessage = fileMangerService.selectById(Integer.valueOf(fatherid));
                if((filetableMessage.getUserid()==filetable.getUserid())&&(filetableMessage.getTenanid()==filetable.getTenanid())){
                    father = filetableMessage.getLocalpath() + filetableMessage.getFilename() + "/";
                }else{
                    //文件夹用户信息，与操作者信息不同，更改
                    filetable.setUserid(filetableMessage.getUserid());
                    filetable.setTenanid(filetableMessage.getTenanid());
                    father = filetableMessage.getLocalpath() + filetableMessage.getFilename() + "/";
                }
            }
            //先判断这个文件夹是否存在，如果存在，返回提示信息
            filetable.setLocalpath(father);
            //先判断这个文件夹是否存在，如果存在，返回提示信息
            filetable.setType(1);
            Filetable r = fileMangerService.selectByParameter(filetable);
            //如果存在的话返回信息
            if (r != null) {
                map.put("code", 1);
                map.put("message", "该文件夹已存在！");
                return map;
            }
            //通过前端所传的数据，然后进行数据的添加，locapath 表示他的上层目录
            fileMangerService.saveFolder(filetable);
            map.put("code", 0);
            map.put("message", "新建文件夹成功");
        } catch (Exception e) {
            LOGGER.info("异常类型是;" + e);
            e.printStackTrace();
            map.put("code", 2);
            map.put("message", "新建文件夹失败");
        }
        LOGGER.info("新建文件夹结束");
        return map;
    }

    /**
     * 查看html内容
     * 业务:通过文件id查询文件信息，从腾讯对象存储下载文件想，
     * 将文件内的html返回
     *
     * @param id
     * @return
     */
    @RequestMapping("/getHtmlContent")
    public String getHtmlContent(HttpServletRequest request, Integer id) {
        LOGGER.info("查看html内容开始 id=" + id);
        ReturnMap ret = new ReturnMap();
        Map<String, Object> map = new HashMap<>();
        try {
            Filetable filetableID = new Filetable();
            filetableID.setId(id);
            Filetable filetable = fileUploadService.getFiletable(filetableID);
            String realPath = Constants.REALPATH;
            User user = new User();
            user.setTenanid(filetable.getTenanid());
            user.setId(filetable.getUserid());
            ReturnMap returnMap = fileUploadService.downloadFile(id, realPath, user, "/html/");
            File file = new File(realPath + "upload/html/" + filetable.getLocalpath() + filetable.getFilename() + "." + filetable.getSuffix());
            BufferedReader bf = new BufferedReader(new FileReader(file));
            String content = "";
            StringBuilder sb = new StringBuilder();
            while (content != null) {
                content = bf.readLine();

                if (content == null) {
                    break;
                }
                sb.append(content.trim());
            }
            bf.close();
            LOGGER.info("查看html内容结束！");
            String object = sb.toString();
            System.out.println(object);
            map.put("data", object);
            ret.setFlg(0);
            ret.setMessage("html内容获取成功！");
            if (file.exists() && file.isFile()) {
                file.delete();
            }
            ret.setData(JSONArray.fromObject(map).toString());
            return ret.ReturnMap();
        } catch (Exception e) {
            LOGGER.info("异常信息为=" + e);
            e.printStackTrace();
            ret.setFlg(2);
            ret.setMessage("内容获取失败！");
            return ret.ReturnMap();
        }
    }

    /**
     * 批量删除html
     * 业务:对多条数据进行逻辑删除，将delflg改为1
     *
     * @param id
     * @return
     * @throwsException sql异常 数据库连接失败
     */
    @RequestMapping("/deleteHtml")
    public String deleteHtml(String[] id) {
        LOGGER.info("批量删除html 文件id=" + id);
        ReturnMap ret = new ReturnMap();
        try {
            fileMangerService.batchDelete(id);
            LOGGER.info("查看html内容结束！");
            ret.setFlg(0);
            ret.setMessage("批量删除html成功！");
            return ret.ReturnMap();
        } catch (Exception e) {
            LOGGER.info("异常信息为=" + e);
            e.printStackTrace();
            ret.setFlg(2);
            ret.setMessage("批量删除html！异常");
            return ret.ReturnMap();
        }
    }

    /**
     * * 文件回退
     * 业务:通过id，找到其父文件的文件地址
     * 将于其父文件文件路径相同的文件返回
     * 将父文件夹的id和路径也一并返回，如
     * id和路径都为空 则在根目录下无法返回
     *
     * @param filetable
     * @param request
     * @param start
     * @param length
     * @return
     */
    @RequestMapping("/backoff")
    public Map<String, Object> backoff(Filetable filetable, String draw, HttpServletRequest request,
                                       @RequestParam(required = false, defaultValue = "1") int start,
                                       @RequestParam(required = false, defaultValue = "10") int length) {
        LOGGER.info("文件回退开始 文件id=" + filetable.getId() + "搜索内容" + request.getParameter("search[value]") +
                "启始页" + start + "条数" + length);
        String searchValue = request.getParameter("search[value]");
        String flag = request.getParameter("flag");
        Map<String, Object> map = new HashMap<>();
        try {
            Filetable filetableID = new Filetable();
            filetableID.setId(filetable.getId());
            Filetable filetableMessage = fileUploadService.getFiletable(filetableID);
            PageInfo<Filetable> pageInfo = fileUploadService.backoffHtml(filetableMessage, flag, searchValue, start, length);
            Map<String, Object> pageInfoStart = fileUploadService.selectByPage(filetableMessage, flag, searchValue, start, length);
            String fatherPath = null;
            String fatherid = null;
            Filetable fatherMessage = new Filetable();
            if (filetableMessage.getLocalpath() == null || "".equals(filetableMessage.getLocalpath())) {
                fatherPath = "";
            } else {
                if (filetableMessage.getLocalpath().equals(filetableMessage.getLocalpath().substring(0, filetableMessage.getLocalpath().indexOf("/") + 1))) {
                    fatherMessage.setFilename(filetableMessage.getLocalpath().substring(0, filetableMessage.getLocalpath().lastIndexOf("/")));
                    fatherMessage.setLocalpath("");
                    fatherMessage.setType(filetableMessage.getType());
                    fatherMessage.setDelflg(filetableMessage.getDelflg());
                    fatherMessage.setUserid(filetableMessage.getUserid());
                    fatherMessage.setTenanid(filetableMessage.getTenanid());
                    fatherMessage.setSuffix("");
                } else {
                    String name = filetableMessage.getLocalpath().substring(0, filetableMessage.getLocalpath().lastIndexOf("/"));
                    fatherMessage.setFilename(name.substring(name.lastIndexOf("/") + 1));
                    fatherMessage.setLocalpath(name.substring(0, name.lastIndexOf('/') + 1));
                    fatherMessage.setType(filetableMessage.getType());
                    fatherMessage.setDelflg(filetableMessage.getDelflg());
                    fatherMessage.setUserid(filetableMessage.getUserid());
                    fatherMessage.setTenanid(filetableMessage.getTenanid());
                    fatherMessage.setSuffix("");
                }
            }

            if (filetableMessage.getLocalpath() == "" || filetableMessage.getLocalpath() == null) {
                pageInfoStart.put("code", 0);
                pageInfoStart.put("id", "");
                pageInfoStart.put("localPath", "");
                return pageInfoStart;
            }
            //判断父文件还是否存在
            Integer count = fileUploadService.selectFileName(fatherMessage);

            if (count == 0) {
                pageInfoStart.put("code", 0);
                pageInfoStart.put("id", "");
                pageInfoStart.put("localPath", "");
                return pageInfoStart;
            }
            Filetable filetableput = fileUploadService.getFiletable(fatherMessage);
            String path = filetableput.getLocalpath() + "" + filetableput.getFilename();
            map.put("localPath", ">" + path.replaceAll("/", ">"));
            map.put("id", filetableput.getId());
            map.put("draw", draw);
            map.put("recordsTotal", pageInfo.getTotal());
            map.put("recordsFiltered", pageInfo.getTotal());
            map.put("data", pageInfo.getList());
            LOGGER.info("文件回退结束！");
            map.put("code", 0);
            map.put("message", "文件回退成功");
            return map;
        } catch (Exception e) {
            LOGGER.info("异常信息为=" + e);
            e.printStackTrace();
            map.put("flg", 2);
            map.put("message", "文件回退异常");
            return map;
        }
    }

    /**
     * 获取html网页链接
     * 业务：通过id获取相关网页的链接地址
     *
     * @param id Intger
     * @return
     * @throwsException sql异常 数据库连接失败
     */
    @RequestMapping("/getHtmlConnect")
    public String getHtmlConnect(Integer id) {
        LOGGER.info("查看html内容 文件id=" + id);
        ReturnMap ret = new ReturnMap();
        try {
            Map<String, Object> map = new HashedMap();
            Filetable filetable = new Filetable();
            filetable.setId(id);
            Filetable filetableMessage = fileUploadService.getHtmlContent(filetable);
            String connect = filetableMessage.getRemotepath();
            map.put("url", connect);
            LOGGER.info("查看html内容结束！");
            ret.setFlg(0);
            ret.setMessage("查看html内容成功！");
            ret.setData(JSONArray.fromObject(map).toString());
            return ret.ReturnMap();
        } catch (Exception e) {
            LOGGER.info("异常信息为=" + e);
            e.printStackTrace();
            ret.setFlg(2);
            ret.setMessage("查看html内容！异常");
            return ret.ReturnMap();
        }
    }
    /**
     * 上传之后的删除文件
     * 业务：1.主要是文件上传之后的弹框里面的删除按钮，当点击删除的时候把该文件从文件列表中删除；
     *      2.此时要判断是在文件夹里面的文件还是在根目录下的文件。
     * @param fatherid 父目录的id
     * @param tenanid  租户id
     * @param userid   用户id
     * @param filename 文件名字
     * @return
     */
    @RequestMapping(value = "/deleteFileByName")
    public String deleteFileByName(String fatherid, String tenanid, String userid, String filename) {
        LOGGER.info("进入删除已上传文件的方法==fatherid=="+fatherid+"==tenanid=="+tenanid+"==userid=="+userid+"==filename=="+filename);
        ReturnMap ret = new ReturnMap();
        try {
            //判断fatherid是否为空 ，如果为空的话说明在根目录下
            Integer type = 1;
            fileMangerService.deleteFileByName(fatherid, Integer.valueOf(tenanid), Integer.valueOf(userid), filename, type);
            ret.setFlg(0);
            ret.setMessage("删除上传后的文件成功");
        } catch (Exception e) {
            e.printStackTrace();
            ret.setFlg(2);
            ret.setMessage("删除上传后的文件失败");
            LOGGER.info("异常类型是" + e);
        }
        LOGGER.info("删除已上传文件的方法结束==fatherid=="+fatherid+"==tenanid=="+tenanid+"==userid=="+userid+"==filename=="+filename);
        return ret.ReturnMap();

    }

}
